Class Effects
    Public Function ApplyBorder(ByVal Bitmap As Bitmap, ByVal BorderWidth As Integer, ByVal Brush As Drawing2D.LinearGradientBrush, ByVal EdgeStyle As EdgeStyle) As Bitmap
        Dim bmp As New Bitmap(Bitmap.Width + (2 * BorderWidth), Bitmap.Height + (2 * BorderWidth))
        Dim border As New Bitmap(bmp.Width, bmp.Height)
        Dim g As Graphics = Graphics.FromImage(border)
        g.FillRectangle(Brush, New Rectangle(0, 0, border.Width, border.Height))
        If EdgeStyle = Effects.EdgeStyle.Square Then

        ElseIf EdgeStyle = Effects.EdgeStyle.Round Then
            'Dim g As Graphics = Graphics.FromImage(border)
            Dim path As New Drawing2D.GraphicsPath
            path.StartFigure()
            path.AddArc(bmp.Width - (2 * BorderWidth), 0, BorderWidth * 2, BorderWidth * 2, 0, -90) '0, 90)
            path.AddLine(bmp.Width - BorderWidth, 0, BorderWidth, 0)
            path.AddArc(0, 0, BorderWidth * 2, BorderWidth * 2, 90, 180)
            path.AddLine(0, BorderWidth, 0, bmp.Height - BorderWidth)
            'lower left
            path.AddArc(0, bmp.Height - (BorderWidth * 2), BorderWidth * 2, BorderWidth * 2, 180, -90) '180, 270)
            path.AddLine(BorderWidth, bmp.Height, bmp.Width - BorderWidth, bmp.Height)
            path.AddArc(bmp.Width - (BorderWidth * 2), bmp.Height - (BorderWidth * 2), BorderWidth * 2, BorderWidth * 2, 0, 360) '270, 0)
            path.AddLine(bmp.Width, bmp.Height - BorderWidth, bmp.Width, BorderWidth)

            'path.Flatten()



            path.CloseFigure()
            Dim B1 As New Drawing2D.PathGradientBrush(path)

            Dim round As New Bitmap(bmp.Width, bmp.Height)
            Dim rG As Graphics = Graphics.FromImage(round)
            Dim transcolor As Color = Color.FromArgb(152, Color.White)
            'rG.FillRectangle(Brushes.White, New Rectangle(0, 0, bmp.Width, bmp.Height))
            For x1 = 0 To round.Width - 1
                For y1 = 0 To round.Height - 1
                    round.SetPixel(x1, y1, transcolor)
                Next
            Next
            B1.CenterPoint = New Point(BorderWidth + 1, 2)

            B1.CenterColor = Color.Black
            B1.SurroundColors = New Color() {Color.Black}
            rG.FillRectangle(B1, New Rectangle(0, 0, bmp.Width, bmp.Height))
            round.MakeTransparent(Color.Black)
            'g.FillRectangle(Brush, New Rectangle(0, 0, bmp.Width, bmp.Height))
            g.DrawImage(round, 0, 0)
            'border.MakeTransparent(Color.White)
            g.DrawImage(Bitmap, BorderWidth, BorderWidth)
            border.MakeTransparent(Color.FromArgb(152, Color.White))
        End If
        Return border
    End Function
    Public Function ApplyBorder(ByVal Bitmap As Bitmap, ByVal BorderWidth As Integer, ByVal Brush As Drawing2D.HatchBrush, ByVal EdgeStyle As EdgeStyle) As Bitmap
        Dim bmp As New Bitmap(Bitmap, Bitmap.Width + (2 * BorderWidth), Bitmap.Height + (2 * BorderWidth))

    End Function

    ''' <param name="Bitmap">The Image to Apply the Border to</param>
    ''' <param name="BorderWidth">The Width(in Pixels) of the Border</param>
    ''' <param name="BorderColor">The Solid Color of the Border</param>
    ''' <param name="EdgeStyle">The Style for Joining each side width</param>
    Public Function ApplyBorder(ByVal Bitmap As Bitmap, ByVal BorderWidth As Integer, ByVal BorderColor As Color, ByVal EdgeStyle As EdgeStyle) As Bitmap
        Dim bmp As New Bitmap(Bitmap.Width + (2 * BorderWidth), Bitmap.Height + (2 * BorderWidth))
        Dim g As Graphics = Graphics.FromImage(bmp)
        Dim b As New SolidBrush(BorderColor)
        g.FillRectangle(b, New Rectangle(0, 0, bmp.Width, bmp.Height))
        g.DrawImage(Bitmap, BorderWidth, BorderWidth)
        Return bmp
    End Function

    Public Function ApplyBorder(ByVal Bitmap As Bitmap, ByVal BorderWidth As Integer, ByVal OuterColor As Color, ByVal InnerColor As Color, ByVal EdgeStyle As EdgeStyle) As Bitmap

        Dim bmp As New Bitmap(Bitmap.Width + (2 * BorderWidth), Bitmap.Height + (2 * BorderWidth))
        Dim bTop As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, bmp.Width, BorderWidth), OuterColor, InnerColor, Drawing2D.LinearGradientMode.Vertical)
        Dim Bleft As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, BorderWidth, bmp.Height), OuterColor, InnerColor, Drawing2D.LinearGradientMode.Horizontal)
        Dim Bbottom As New Drawing2D.LinearGradientBrush(New Rectangle(0, bmp.Height - BorderWidth, bmp.Width, BorderWidth), InnerColor, OuterColor, System.Drawing.Drawing2D.LinearGradientMode.Vertical)
        Dim BRight As New Drawing2D.LinearGradientBrush(New Rectangle(bmp.Width - BorderWidth, 0, BorderWidth, bmp.Height), InnerColor, OuterColor, Drawing2D.LinearGradientMode.Horizontal)
        'bTop.SetBlendTriangularShape(0.5)
        'Bleft.SetBlendTriangularShape(0.5)
        'Bbottom.SetBlendTriangularShape(0.5)
        'BRight.SetBlendTriangularShape(0.5)

        Dim g As Graphics = Graphics.FromImage(bmp)
        g.DrawImage(Bitmap, BorderWidth, BorderWidth)
        g.FillRectangle(bTop, New RectangleF(BorderWidth, 0, bmp.Width - (2 * BorderWidth), BorderWidth))
        g.FillRectangle(Bleft, New Rectangle(0, BorderWidth, BorderWidth, bmp.Height - (2 * BorderWidth)))
        g.FillRectangle(BRight, New Rectangle(bmp.Width - BorderWidth, BorderWidth, BorderWidth, bmp.Height - (2 * BorderWidth)))
        g.FillRectangle(Bbottom, New Rectangle(BorderWidth, bmp.Height - BorderWidth, bmp.Width - (2 * BorderWidth), BorderWidth))
        Dim Edge As New Bitmap(BorderWidth, BorderWidth)
        Dim graph As Graphics = Graphics.FromImage(Edge)
        If EdgeStyle = Effects.EdgeStyle.Mitter Then

            Dim path As New Drawing2D.GraphicsPath
            path.AddPolygon(New Point() {New Point(0, 0), New Point(BorderWidth, BorderWidth), New Point(0, BorderWidth)})
            Dim BEdge As New Drawing2D.PathGradientBrush(path)
            BEdge.CenterColor = InnerColor
            BEdge.SurroundColors = New Color() {OuterColor}
            BEdge.CenterPoint = New Point(0, BorderWidth)
            'BEdge.SetBlendTriangularShape(0.5)
            graph.FillRectangle(BEdge, New Rectangle(0, 0, Edge.Width, Edge.Height))
        ElseIf EdgeStyle = Effects.EdgeStyle.Round Then
            Dim path As New Drawing2D.GraphicsPath
            'path.AddPolygon(New Point() {New Point(0, 0), New Point(BorderWidth, BorderWidth), New Point(0, BorderWidth)})
            Dim rect As Rectangle = New Rectangle(-1 * BorderWidth - 1, 0, BorderWidth * 2, BorderWidth * 2)
            path.AddArc(rect, 0, 360)

            Dim BEdge As New Drawing2D.PathGradientBrush(path)
            BEdge.CenterColor = InnerColor
            BEdge.SurroundColors = New Color() {OuterColor}
            BEdge.CenterPoint = New Point(0, BorderWidth)
            'BEdge.SetBlendTriangularShape(0.5)
            graph.FillRectangle(BEdge, New Rectangle(0, 0, Edge.Width, Edge.Height))

        ElseIf EdgeStyle = Effects.EdgeStyle.Square Then
            Dim path As New Drawing2D.GraphicsPath
            path.AddPolygon(New Point() {New Point(0, 0), New Point(BorderWidth, 0), New Point(BorderWidth, BorderWidth), New Point(0, BorderWidth)})
            'Dim rect As Rectangle = New Rectangle(-1 * BorderWidth, 0, BorderWidth * 2, BorderWidth * 2)

            Dim BEdge As New Drawing2D.PathGradientBrush(path)
            BEdge.CenterColor = InnerColor
            BEdge.SurroundColors = New Color() {OuterColor}
            BEdge.CenterPoint = New Point(0, BorderWidth)
            'BEdge.SetBlendTriangularShape(0.5)
            graph.FillRectangle(BEdge, New Rectangle(0, 0, Edge.Width, Edge.Height))

        End If
        g.DrawImage(Edge, New Point(bmp.Width - BorderWidth, 0))
        Edge.RotateFlip(RotateFlipType.Rotate90FlipNone)
        g.DrawImage(Edge, New Point(bmp.Width - BorderWidth, bmp.Height - BorderWidth))
        Edge.RotateFlip(RotateFlipType.Rotate90FlipNone)
        g.DrawImage(Edge, New Point(0, bmp.Height - BorderWidth))
        Edge.RotateFlip(RotateFlipType.Rotate90FlipNone)
        g.DrawImage(Edge, New Point(0, 0))
        Return bmp
    End Function

    Public Function ApplyBorder(ByVal Bitmap As Bitmap, ByVal BorderWidth As Integer, ByVal LightColor As Color, ByVal DarkColor As Color, ByVal Lighting As Lighting, ByVal EdgeStyle As EdgeStyle, ByVal BorderStyle As BorderStyle) As Bitmap
        Dim bmp As New Bitmap(Bitmap, Bitmap.Width + (2 * BorderWidth), Bitmap.Height + (2 * BorderWidth))
        Dim Horrizontal As New Bitmap(bmp.Width, BorderWidth)
        Dim Verticle As New Bitmap(BorderWidth, bmp.Height)
        If BorderStyle = Effects.BorderStyle.Gradient Then
            Dim b1 As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, Horrizontal.Width, Horrizontal.Height), LightColor, DarkColor, Drawing2D.LinearGradientMode.Vertical)
            Dim b2 As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, Verticle.Width, Verticle.Height), LightColor, DarkColor, Drawing2D.LinearGradientMode.Horizontal)

        End If
    End Function

    Public Enum EdgeStyle
        Mitter = 0
        Square = 1
        Round = 2

    End Enum
    Public Enum BorderStyle
        ''' <summary>
        ''' specifies an even fade from 1 color to another
        ''' </summary>
        ''' <remarks></remarks>
        Gradient = 1
        ''' <summary>
        ''' Specifies a border that has 1 solid color on the outside
        ''' and 1 solid color on the inside
        ''' </summary>
        ''' <remarks></remarks>
        Solid = 2
    End Enum
    Public Enum Lighting
        None = 1
        Top = 2
        Right = 3
        Left = 4
        Bottom = 5

        TopRight = 6
        TopLeft = 7
        BottomRight = 8
        BottomLeft = 9

    End Enum
End Class
